function [X, Y, b] = model(et, X, Y, b)
    T = et.tget(1);
    s = Section(T, 0.2);

    if nargin == 1
        X = []; Y = []; b = [];
    elseif nargin ~= 4
        error('Usage: model(et, X, Y, b)');
    end

    for i = 2 : numel(s)
        st = s(i - 1);
        ed = s(i);

        % temperature increases
        if (T(ed) - T(st)) / (ed - st) * 60 < 2
            continue;
        end

        if isempty(b)
            X = et.Temp(st:ed, [1 3 4]);
            Y = et.Eddy(st:ed, 1);
        else
            x = et.Temp(st:ed, [1 3 4]);
            y = et.Eddy(st:ed, 1);
            c = y - [ones(numel(y), 1) x] * b;
            [up, lo, ~] = Box(c);
            c(c > up | c < lo) = [];
            y = y - mean(c);

            X = [X; x];
            Y = [Y; y];
        end

        [b, ~, r, ~, ~] = regress(Y, [ones(numel(Y), 1), X], 0.05);
        fprintf(1, 'maxR=%f\t', max(abs(r)));
        fprintf(1, '%.2f\t%.2f\t%.2f\t%.2f\n', b(1), b(2), b(3), b(4));
    end
end
